import json

with open("MUSER-main/component.json") as fin:
    logic_dict = json.load(fin)


event_type_list = logic_dict.keys()

feature_list = set()
for event, logic_tree_list in logic_dict.items():
    for tree in logic_tree_list:
        for k, v in tree.items():
            if k == "根":
                continue
            if not v["叶子"]:
                feature_list.add(k)

feature_list = list(feature_list)
feature_list.sort()

def get_f_index(feature):
    return feature_list.index(feature)

def get_f_size():
    return len(feature_list)

if __name__ == "__main__":
    print(get_f_index('默认为“部分债权转让的，最高额抵押权不得转让'))